//
// Thread.h
// Usage: Thread object
// CreateDate: 2009-04-06
// Author: MaJiuyue
//
#ifndef _THREAD_H_
#define _THREAD_H_

#include "type.h"

class Process;

struct THREAD_BLOCK
	{
		/* Process contain this thread */
		Process * process;
		/* Thread's register status(72byte, 18dword) */
		regs_t regs;

		/* Thread's kernel stack, make sure sizeof(THREAD_BLOCK)=8K */
		u32 stack[2029];
	};


class Thread
{
private:
	 THREAD_BLOCK *m_pThread;
public:
	Thread(Process * process);
	Thread(const Thread& target, Process * process);
	~Thread();

public:
	/* Restart thread run */
	void Restart();
	
	THREAD_BLOCK *GetTCB(){return m_pThread;}
	/* Manipulate register */
	u32 GetRegisterValue(REGS_INDEX index);
	void SetRegisterValue(REGS_INDEX index, u32 value);
};

#endif

